#include<bits/stdc++.h>
using namespace std;
int main()
{
	string a,b,c;
	cin>>a>>b;
	if (a.size()<b.size())
	{
		c=a;
		a=b;
		b=c;
	}
	a+=a;
	if (a.find(b,0)<=a.size()) cout<<"true";
	else cout<<"false";
	
	
	return 0;
}